//
//  ServiceMercAddMsgVM.swift
//  kxf
//
//  Created by Elavatine on 2024/10/4.
//


import UIKit
import SwiftUI

class ServiceMercAddMsgVM: UIView {
    
    var selfHeight = RegisterViewHeadTitleVM().selfHeight+RegisterInputVM().selfHeight*3
    
    override init(frame:CGRect){
        super.init(frame: CGRect.init(x: 0, y: frame.origin.y, width: SCREEN_WIDHT, height: selfHeight))
        self.backgroundColor = .white
        self.isUserInteractionEnabled = true
        
        initUI()
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    lazy var titleVm : RegisterViewHeadTitleVM = {
        let vm = RegisterViewHeadTitleVM.init(frame: CGRect.init(x: 0, y: 0, width: 0, height: 0))
        vm.titleLabel.text = "信息"
        return vm
    }()
    lazy var mercNameAllVm : RegisterInputVM = {
        let vm = RegisterInputVM.init(frame: CGRect.init(x: 0, y: self.titleVm.frame.maxY, width: 0, height: 0))
        vm.leftLabel.text = "代理商名称"
        vm.textField.placeholder = "请输入代理商名称"
        vm.textField.keyboardType = .default
        vm.maxLength = 30
        
        return vm
    }()
    lazy var mercPhoneVm : RegisterInputVM = {
        let vm = RegisterInputVM.init(frame: CGRect.init(x: 0, y: self.mercNameAllVm.frame.maxY, width: 0, height: 0))
        vm.leftLabel.text = "登录手机号"
        vm.textField.placeholder = "登录手机号"
        vm.textField.keyboardType = .numberPad
        return vm
    }()
    lazy var mercPswVm : RegisterInputVM = {
        let vm = RegisterInputVM.init(frame: CGRect.init(x: 0, y: self.mercPhoneVm.frame.maxY, width: 0, height: 0))
        vm.leftLabel.text = "密码"
        vm.textField.placeholder = "请输入密码"
        vm.textField.keyboardType = .asciiCapable
        return vm
    }()
}

extension ServiceMercAddMsgVM{
    func initUI() {
        addSubview(titleVm)
        addSubview(mercNameAllVm)
        addSubview(mercPhoneVm)
        addSubview(mercPswVm)
    }
}
